﻿@using CRM.Admin.Areas.Customer.Controllers
@using CRM.Admin.Contracts.Dto.Sys
@model CRM.Admin.Contracts.Dto.Customer.ProductDto
@{
    ViewBag.Title = "ProductEdit";
}
@section head
{
    <script src="@Url.Content("~/ScriptPlugin/validate/validate.js")"></script>
    <link href="@Url.Content("~/ScriptPlugin/validate/validate.css")" rel="stylesheet" />
    <script type="text/javascript" src="@Url.Content("~/Scripts/form2json.js")"></script>
   <script type="text/javascript" src="@Url.Content("~/Scripts/jquery.validate.min.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/Scripts/jquery.validate.extended.js")"></script>
    <script type="text/javascript">

    function SaveData(index) {
            if (K.Validate())
            {
                var dto = $('#ProductEdit').serializeJson();
                K.AjaxJson("@Url.Content("~/Customer/Product/ProductUpdate")", dto, function (result) {
                    if (K.ShowOrAlert(result)) {
                        parent.K.layer.callback(index, dto);
                        parent.K.layer.close(index);
                    }
                });
            }
    }
    </script>
}
<form action="" id="productEdit" name="productEdit">
    <div class="content-form">
        <table class="content-table">
            <tr>
                <th><span>产品名称/品种</span></th>
                <td>
                    <input type="hidden" id="CustomerId" name="CustomerId" value="@ViewBag.CustomerId" />
                    <input type="hidden" id="Id" name="Id" value="@Model.Id" />
                    <input type="text" data-valid="required" id="Name" name="Name" value="@Model.Name" />
                </td>
                <th>年产量/销售量</th>
                <td>
                    <input type="text" id="SaleWeight" value="@Model.SaleWeight" name="SaleWeight" />
                </td>
            </tr>
            <tr>
                <th>需钢材量</th>
                <td>
                    <input type="text" id="NeedSteelWeight" name="NeedSteelWeight" value="@Model.NeedSteelWeight"/>
                </td>
                <th>

                </th>
                <td></td>
            </tr>
            <tr>
                <th>使用钢材品种</th>
                <td>
                    <input type="text" id="UseSteelType" name="UseSteelType" value="@Model.UseSteelType"/>
                </td>
                <th>
                    使用钢材品种单耗
                </th>
                <td>
                    <input type="text" id="Consumption" name="Consumption" value="@Model.Consumption"/>
                </td>
            </tr>
        </table>
    </div>
</form>
@section foot


{
    <script type="text/javascript">


        function SaveData(index) {
            if ($("#productEdit").valid()) {
                var dto = $("#productEdit").serializeArray();
                K.AjaxJson("@Url.Content("~/Customer/Product/ProductUpdate")", dto, function (result) {
                    parent.K.layer.callback(index, result, dto);
                    parent.K.layer.close(index);
                });
            }
        }
    </script>
}




